package com.cheneylo.cmp.controller;

import com.cheneylo.cmp.mapper.Z2024Mapper;
import com.cheneylo.cmp.mapper.ZhiyuanMapper;
import com.cheneylo.cmp.pojo.Z2024;
import com.cheneylo.cmp.service.Z2024Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class Z2024Controller {
    @Autowired
    private Z2024Mapper z2024Mapper;
    @PostMapping("/getScoreByRank")
    @CrossOrigin(origins = "*")
    public int getScoreByRank(@RequestParam(value = "num") int num)
    {
        int score = 0;
        List<Z2024>  Z2024S=z2024Mapper.findAll();
        for (int i = 0; i < Z2024S.size(); i++)
        {
            if(Z2024S.get(i).getNum()<=num) {

                score=Z2024S.get(i+1).getScore();

            }

        }
        return score;
    }
}
